package com.xyoto.community.controller;

import com.xyoto.community.dto.DeleteQuestionCommentLoveDTO;
import com.xyoto.community.dto.SaveQuestionCommentLoveDTO;
import com.xyoto.community.service.QuestionCommentLoveService;
import com.xyoto.community.utils.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.apache.ibatis.annotations.Delete;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

//@RestController
@RequestMapping("/topic")
@Api(value = "问答评论点赞（前台）", tags = "问答评论点赞（前台）")
public class QuestionCommentLoveController {

    @Autowired
    private QuestionCommentLoveService commentLoveService;

    @ApiOperation(value = "新增问答评论点赞（前台）", notes = "新增问答评论点赞（前台）")
    @PostMapping("/saveQuestionCommentLove")
    public Result saveQuestionCommentLove(@RequestBody @Validated SaveQuestionCommentLoveDTO commentLoveDTO){
        return commentLoveService.saveQuestionCommentLove(commentLoveDTO);
    }

    /**
     * 取消问答评论点赞
     * @param deleteQuestionCommentLoveDTO 问答评论id
     * @return
     */
    @ApiOperation("取消问答评论点赞")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "questionCommentId" ,value = "问答评论id" , required = true)
    })
    @DeleteMapping("removeQuestionCommentLove")
    public Result removeQuestionCommentLove(@RequestBody DeleteQuestionCommentLoveDTO deleteQuestionCommentLoveDTO){
        return commentLoveService.removeQuestionCommentLove(deleteQuestionCommentLoveDTO.getQuestionCommentId());
    }

}
